package com.example.common.common.config.llm;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.PromptChatMemoryAdvisor;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/8/3 22:39
 **/
@Configuration
public class AIClientConfig {
    @Bean
    public ChatClient chatClient(OpenAiChatModel model, RedisMemoryRepository redisMemoryRepository) {
        PromptChatMemoryAdvisor memoryAdvisor = PromptChatMemoryAdvisor.builder(redisMemoryRepository).build();
        return ChatClient.builder(model)
                .defaultAdvisors(
                        new SimpleLoggerAdvisor(), memoryAdvisor)
                .build();
    }


//    @Bean
//    public InMemoryChatMemory inMemoryChatMemory() {
//        return new InMemoryChatMemory();
//    }


//    @Bean
//    public VectorStore vectorStore(OpenAiEmbeddingModel embeddingModel) {
//        return SimpleVectorStore.builder(embeddingModel).build();
//    }
}
